from selenium import webdriver
import time
from selenium.webdriver.common.by import By

dr = webdriver.Chrome()
dr.get("file:///C:/Users/Administrator/Desktop/自动化测试网页/自动化测试网页/注册A.html")
time.sleep(2)
dr.maximize_window()
time.sleep(2)
# 输出当前窗口
print(dr.current_window_handle)
print(dr.current_url)
dr.find_element(By.ID,"fw").click()
print(dr.current_window_handle)
print(dr.current_url)
# 切换窗口
w = dr.window_handles
dr.switch_to.window(w[-1])
print(dr.current_window_handle)
print(dr.current_url)
time.sleep(2)
dr.quit()